#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <map>
#include <vector>
using namespace std;
void setZeroes(vector<vector<int>>& matrix) {
    multimap<int, int> cur;
    for (int i = 0; i < matrix.size(); i++)
    {
        for (int j = 0; j < matrix[0].size(); j++)
        {
            if (matrix[i][j] == 0)
                cur.insert({ i, j });
        }
    }
    multimap<int, int>::iterator it = cur.begin();
    while (it != cur.end())
    {
        for (int n = 0; n < matrix[0].size(); n++)
        {
            matrix[it->first][n] = 0;
        }
        for (int n = 0; n < matrix.size(); n++)
        {
            matrix[n][it->second] = 0;
        }
        it++;
    }
}
int main()
{
    vector<vector<int>> cur{ {0, 1, 2, 0}, {3, 4, 5, 2}, { 1, 3, 1, 5 } };
    setZeroes(cur);
}
